home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Headers / misckit / MiscSplitView.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-07  |  3.8 KB  |  123 lines

  1. //
  2. //  MiscSplitView.h
  3. //
  4. //  Written by Dwight D. Everhart, based on SideSplitView by Mary McNabb
  5. //  of NeXT (from the ZooView mini-example).
  6. //
  7. //  Copyright (c) 1996 by Dwight D. Everhart.  All rights reserved.
  8. //  Version 1.11; February 7, 1996
  9. //
  10. //      This notice may not be removed from this source code.
  11. //
  12. //  This object is included in the MiscKit by permission from the author
  13. //  and its use is governed by the MiscKit license, found in the file
  14. //  "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  15. //  for a list of all applicable permissions and restrictions.
  16. //
  17. //  Although this code started as SideSplitView, there is little that remains
  18. //  of the original code.  Still, the author is grateful to Ms. McNabb for
  19. //  providing a starting point for this code.  This is the distribution notice
  20. //  that she put in her code:
  21. //
  22. //    You may freely copy, distribute, and reuse the code in this example.
  23. //    NeXT disclaims any warranty of any kind, expressed or implied, as to its
  24. //    fitness for any particular use.
  25. //
  26. //  Purpose:
  27. //    This class implements a view which divides its frame, either vertically
  28. //    or horizontally, into two or more adjacent areas in which are displayed
  29. //    its subviews.  The user can change the proportion of the areas occupied
  30. //    by the subviews relative to each other.  The class can also save and
  31. //    restore its subview divisions to a string or a default.  The interface
  32. //    is compatible with NXSplitView, and the divisions saving mechanism has
  33. //    the same style of interface as Window's frame saving mechanism.
  34. //
  35. //  Requires:
  36. //    MiscAppDefaults category
  37. //    Dimple.tiff image (embedded into Dimple.m by Don Yacktman)
  38. //
  39.  
  40. #import <appkit/appkit.h>
  41.  
  42. @interface MiscSplitView: View
  43.  
  44. {
  45.    id delegate;
  46.    struct _msvFlags {
  47. #ifdef __BIG_ENDIAN__
  48.       unsigned int horizontal:1;
  49.       unsigned int needsRetiling:1;
  50.       unsigned int _RESERVED:6;
  51. #else
  52.       unsigned int _RESERVED:6;
  53.       unsigned int needsRetiling:1;
  54.       unsigned int horizontal:1;
  55. #endif
  56.    } msvFlags;
  57. }
  58.  
  59. /* Initializing a MiscSplitView */
  60. + initialize;
  61. - initFrame: (const NXRect *) frameRect;
  62.  
  63. /* Assigning a delegate */
  64. - delegate;
  65. - setDelegate: anObject;
  66.  
  67. /* Assigning orientation */
  68. - (BOOL) isHorizontal;
  69. - setHorizontal: (BOOL) makeHorizontal;
  70.  
  71. /* Accessing the dividers */
  72. - setDividersFromString:   (const char *) data;
  73. - saveDividersToString:    (char *) string;
  74. - setDividersUsingName:    (const char *) name;
  75. - saveDividersUsingName:   (const char *) name;
  76. + removeDividersUsingName: (const char *) name;
  77. - (const char *) dividersAutosaveName;
  78. - setDividersAutosaveName: (const char *) name;
  79.  
  80. /* Drawing the view */
  81. - (NXCoord) dividerSize;
  82. - (NXCoord) dividerHeight;
  83. - (NXCoord) dividerWidth;
  84. - drawSelf: (const NXRect *) rects : (int) rectCount;
  85. - drawDivider: (const NXRect *) aRect;
  86.  
  87. /* Managing component views */
  88. - constrainDivider: (int) dividerIndex
  89.   leftFrame:  (const NXRect *) leftFrame
  90.   rightFrame: (const NXRect *) rightFrame
  91.   min: (NXCoord *) min max: (NXCoord *) max;
  92. - constrainFramesLeft: (NXRect *) leftFrame andRight: (NXRect *) rightFrame
  93.   besideDivider: (int) dividerIndex;
  94. - adjustSubviews;
  95. - resizeSubviews: (const NXSize *) oldSize;
  96. - setAutoresizeSubviews: (BOOL) flag;
  97. - addSubview: aView;
  98. - addSubview: aView : (int) place relativeTo: otherView;
  99. - replaceSubview: oldView with: newView;
  100.  
  101. /* Handling events */
  102. - (BOOL) acceptsFirstMouse;
  103. - mouseDown: (NXEvent *) theEvent;
  104.  
  105. /* Archiving */
  106. - write: (NXTypedStream *) stream;
  107. - read:  (NXTypedStream *) stream;
  108.  
  109. @end
  110.  
  111.  
  112. @interface Object (MiscSplitViewDelegate)
  113.  
  114. - splitView: sender resizeSubviews: (const NXSize *) oldSize;
  115. - splitView: sender getMinY: (NXCoord *) minY maxY: (NXCoord *) maxY
  116.   ofSubviewAt: (int) offset;
  117. - splitView: sender getMinX: (NXCoord *) minX maxX: (NXCoord *) maxX
  118.   ofSubviewAt: (int) offset;
  119. - splitViewDidResizeSubviews: sender;
  120.  
  121. @end
  122.  
  123.